<?php
return array(
	'rules' => array(
		array('goods_name','safe')
	),

	'behaviors' => array(
		'search' => array(
			'class' => 'application.behaviors.SearchBehavior',
			'timeSearch' => 'create_time',
			'searchModel' => 'GoodsAgentRelatedSearch'
		),
		'listingStateHandle' => array(
			'class' => 'ModelState',
			'handleField' => 'listing_status',
			'configName' => 'status.agent.goodsListing',
			'configReader' => Yii::app()->config,
			'initState' => 'ST_NONE',
		),
		'userScope' => array(
			'class' => 'coms.behaviors.userScopes.DefaultScope',
			'relatedFields' => array(
				'provider_id',
				'dealer_id',
			),
		),
	),
	'attributeLabels' => array(
		'provider.worker_name' => '供应商',
		'dealer.worker_name' => '经销商',
		'listing_status' => '上架状态',
		'goods_name' => '商品名称'
	),
	'relations' => array(
		'goods' => array(CActiveRecord::BELONGS_TO, 'Goods', 'goods_id'),
		'provider' => array(CActiveRecord::BELONGS_TO, 'WorkerAccount', 'provider_id'),
		'dealer' => array(CActiveRecord::BELONGS_TO, 'WorkerAccount', 'dealer_id'),
	),
	'_import' => array(
		array('*', 'models.ActiveRecord//*'),
	),
);